package com.hcq.controller;

import com.common.entity.Hotel;
import com.common.entity.PageParam;
import com.common.entity.Proposal;
import com.common.entity.Rsp;
import com.hcq.service.ProposalService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProposalController {

    @Autowired
    ProposalService proposalService;

    //    @SystemControllerLog(description = "分页查询用户信息")
    @PostMapping("/searchSomeProposalByPage")
//    @RequireRoles(roles = {"admin","super_admin","reception","guide","tourist"},index = 1)
    @ApiOperation("查询所有 支持 多条件 分页 排序 查询")
    public Rsp searchSomeByPage(@RequestBody PageParam<Proposal> proposalPageParam, @RequestHeader("token") String token) {
        System.out.println(proposalPageParam);
        return Rsp.success(proposalService.searchSomeByPage(proposalPageParam));
    }

    @PostMapping("/addOne")
    @ApiOperation("添加")
    public Rsp addOne(@RequestBody Proposal proposal,@RequestHeader("token") String token){
        return proposalService.addOne(proposal);
    }

    @PostMapping("/update")
    @ApiOperation("修改")
    public Rsp update(@RequestBody Proposal proposal,@RequestHeader("token") String token){
        System.out.println(proposal.toString());
        return proposalService.update(proposal);
    }

    @PostMapping("/deleteLogical")
    @ApiOperation("逻辑删除")
    public Rsp deleteLogical(@RequestBody Proposal proposal){
        return proposalService.deleteLogical(proposal);
    }
}
